<%@ page language="java" contentType="texe/html; chraset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*,java.sql.*"%>


<jsp:useBean id="dbConnection" scope="page" class="DB.DBConnection"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" Content="text/heml; charset=UTF-8">
    
    <title>验证并提交数据</title>

  </head>
  
  <body><br>
   <% 
   		request.setCharacterEncoding("utf-8");
      String UserPwd = (String)request.getParameter("UserPwd"); 
      String ReUserPwd = (String)request.getParameter("ReUserPwd"); 
      if(!UserPwd.equals(ReUserPwd)){ 
         response.sendRedirect("reg.jsp"); 
      } 
      String name = (String)request.getParameter("UserName"); 
      String UserEMail = (String)request.getParameter("UserEMail"); 
      String sex = (String)request.getParameter("Sex"); 
      //String birthday = (String)request.getParameter("birthday"); 
      String year = (String)request.getParameter("year");
      String month = (String)request.getParameter("month");
      String day = (String)request.getParameter("day");
      String province = (String)request.getParameter("prov"); 
      String city = (String)request.getParameter("city"); 
      String remark = (String)request.getParameter("Remark"); 
      dbConnection.getConnection();
      try{ 
      	
          String sql = "insert into usr_info(usr_name,usr_pwd,usr_mail,usr_sex,usr_birthday,usr_province,usr_city,usr_remark)VALUES('"+name+"','"+UserPwd+"','"+UserEMail+"','"+sex+"','"+year.toString()+"-"+month.toString()+"-"+day.toString()+"','"+province+"','"+city+"','"+remark+"')"; 
          System.out.println(sql);
          dbConnection.executeInsert(sql);
      }catch(Exception e){ 
          e.printStackTrace(); 
      } 
      response.sendRedirect("regsuccess.jsp"); 
    %>
  </body>
</html>
